<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use App\Repositories\Eloquent\MemberRepository;
use App\Repositories\Eloquent\ManageRepository;
use Auth, DB, Hash, Redirect;

class SuperController extends Controller
{
    protected $member, $manage;
    
    /**
     * 构造方法，创建MemberRepository实例
     * @param MemberRepository $member [description]
     */
    public function __construct(MemberRepository $member, ManageRepository $manage)
    {
        parent::__construct();

        $this->member = $member;

        $this->manage = $manage;
    }


    public function rank()
    {
        $member = Auth::guard()->user();

        $ranks = $this->member->ranks();

        return view($this->view, compact('member','ranks'));
    }


    public function manage()
    {
        $member = Auth::guard()->user();

        return view($this->view, compact('member'));
    }


    public function text($type)
    {
        $text = $this->manage->content($type)->get()->first();

        return view($this->view, compact('text'));
    }


    public function postText(Request $request)
    {
        return $this->manage->renew($request);
    }


    public function swiper()
    {
        $swipers = $this->manage->content('swiper')->get();

        return view($this->view, compact('swipers'));
    }
}